package leetcode_801_900;

public class LeeCode_858 {
    public static void main(String[] args) {
        System.out.println(mirrorReflection(3, 2));
    }
    private static int mirrorReflection(int p, int q) {
        int max = p, min = q;
        while (min != 0){
            int yu = max % min;
            max = min;
            min = yu;
        }
        int k = (p * q) / max;
        k /= q;
        if (k % 2 == 0)
            return 2;
        if (((k * q) / p) % 2 == 0)
            return 0;
        return 1;
    }
}
